package com.moo2u2.android.oaktononthego.crm.dao;

import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class OpportunityTable {

    public static final String KEY_ROWID = "_id";
    public static final String KEY_CUSTOMER = "customer";
    public static final String KEY_DESC = "description";
    public static final String DB_TABLE = "opportunities";

    private static final String DATABASE_CREATE = "create table " + DB_TABLE
            + "(" + KEY_ROWID + " integer primary key autoincrement, "
            + KEY_DESC + " text not null, " + KEY_CUSTOMER + " long not null);";

    public static void onCreate(SQLiteDatabase database) {
        database.execSQL(DATABASE_CREATE);
    }

    public static void onUpgrade(SQLiteDatabase database, int oldVersion,
            int newVersion) {
        Log.w(OpportunityTable.class.getName(),
                "Upgrading database from version " + oldVersion + " to "
                        + newVersion + ", which will destroy all old data");
        database.execSQL("DROP TABLE IF EXISTS " + DB_TABLE);
        onCreate(database);
    }
}